home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 414_01 / default.c < prev    next >
C/C++ Source or Header  |  1993-11-15  |  24KB  |  686 lines

  1. /***********************************************************************/
  2. /* DEFAULT.C - Default settings and profile processing                 */
  3. /***********************************************************************/
  4. /*
  5.  * THE - The Hessling Editor. A text editor similar to VM/CMS xedit.
  6.  * Copyright (C) 1991-1993 Mark Hessling
  7.  *
  8.  * This program is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU General Public License as
  10.  * published by the Free Software Foundation; either version 2 of
  11.  * the License, or any later version.
  12.  *
  13.  * This program is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16.  * General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU General Public License
  19.  * along with this program; if not, write to:
  20.  *
  21.  *    The Free Software Foundation, Inc.
  22.  *    675 Mass Ave,
  23.  *    Cambridge, MA 02139 USA.
  24.  *
  25.  *
  26.  * If you make modifications to this software that you feel increases
  27.  * it usefulness for the rest of the community, please email the
  28.  * changes, enhancements, bug fixes as well as any and all ideas to me.
  29.  * This software is going to be maintained and enhanced as deemed
  30.  * necessary by the community.
  31.  *
  32.  * Mark Hessling                     email: M.Hessling@gu.edu.au
  33.  * 36 David Road                     Phone: +61 7 849 7731
  34.  * Holland Park                      Fax:   +61 7 875 5314
  35.  * QLD 4121
  36.  * Australia
  37.  */
  38.  
  39. /*
  40. $Header: C:\THE\RCS\default.c 1.4 1993/09/01 16:26:04 MH Interim MH $
  41. */
  42.  
  43. #include <stdio.h>
  44.  
  45. #include "the.h"
  46. #include "proto.h"
  47.  
  48. /*#define DEBUG 1*/
  49.  
  50. /*--------------------------- extern data -----------------------------*/
  51. extern WINDOW *foot;
  52. extern VIEW_DETAILS *vd_current,*vd_first;
  53. extern char current_screen;
  54. extern SCREEN_DETAILS screen[MAX_SCREENS];        /* screen structures */
  55. extern char display_screens;                      /* number of screens */
  56. extern bool horizontal;
  57. extern char current_file;                   /* pointer to current file */
  58. extern LINE *next_line,*curr_line;
  59. extern char *rec;
  60. extern char in_profile;    /* indicates if processing profile */
  61. extern char number_of_views;                        /* number of files */
  62. extern char number_of_files;                   /* number of open files */
  63.  
  64. /*--------------------------- global data -----------------------------*/
  65.  
  66.  char CMD_LINEx;
  67.  char ERROR_ROWx;
  68.  char TAB_ROWx;
  69.  char TAB_ONx;
  70.  char SCALE_ROWx;
  71.  char SCALE_ONx;
  72.  char PREFIXx;
  73.  char CURRENT_ROW_POSx;
  74.  char STAYx;
  75.  char HEXx;
  76.  char NEWLx;
  77.  char MSGMx;
  78.  char CASE_Ex;
  79.  char CASE_Lx;
  80.  char CASE_Cx;
  81.  char CASE_Sx;
  82.  char TABI_ONx;
  83.  char TABI_Nx;
  84.  char TABO_ONx;
  85.  char TABO_Nx;
  86.  char TABSx;
  87.  char CMDARROWSTABCMDx;
  88.  char CMDARROWSTABTXTx;
  89.  char CMDARROWSTABLRx;
  90.  char AUSx;
  91.  char EOLx;
  92.  unsigned short VER_STAx;
  93.  unsigned short VER_ENDx;
  94.  unsigned short VER_COLx;
  95.  unsigned short ZON_STAx;
  96.  unsigned short ZON_ENDx;
  97.  char  ARB_STSx;
  98.  char  ARB_CHRx;
  99.  char  DISPLAY_LOWx;
  100.  char  DISPLAY_HIGHx;
  101.  bool LINEND_STATUSx;
  102.  char  LINEND_VALUEx;
  103.  char NONDISPx;
  104.  bool REPROFILEx;
  105.  bool CLEARSCREENx;
  106.  bool IMPMACROx;
  107.  bool IMPOSx;
  108.  bool NUMBERx;
  109.  bool BACKUPx;
  110.  bool BEEPx;
  111.  bool CLOCKx;
  112.  bool HEXDISPLAYx;
  113.  bool CAPREXXOUTx;
  114.  long CAPREXXMAXx;
  115.  
  116. /***********************************************************************/
  117. #ifdef PROTO
  118. void set_defaults(void)
  119. #else
  120. void set_defaults()
  121. #endif
  122. /***********************************************************************/
  123. {
  124. /*--------------------------- local data ------------------------------*/
  125. /*--------------------------- processing ------------------------------*/
  126. #ifdef TRACE
  127.  trace_function("default.c: set_defaults");
  128. #endif
  129.  CMD_LINEx = 'B';
  130.  ERROR_ROWx = 1;
  131.  TAB_ROWx = 6;
  132.  TAB_ONx = FALSE;
  133.  SCALE_ROWx = 6;
  134.  SCALE_ONx = FALSE;
  135.  PREFIXx = PREFIX_LEFT;
  136.  CURRENT_ROW_POSx = 0;
  137.  STAYx = ON;
  138.  HEXx = OFF;
  139.  NEWLx = TRUE;
  140.  MSGMx = TRUE;
  141.  
  142.  CASE_Ex = CASE_MIXED;
  143.  CASE_Lx = CASE_IGNORE;
  144.  CASE_Cx = CASE_RESPECT;
  145.  CASE_Sx = CASE_RESPECT;
  146.  
  147.  LINEND_STATUSx = FALSE;
  148.  LINEND_VALUEx = '#';
  149.  
  150.  NONDISPx = '#';
  151.  
  152.  TABI_ONx = FALSE;
  153.  TABI_Nx = 8;
  154.  TABO_ONx = FALSE;
  155.  TABO_Nx = 8;
  156.  TABSx = 8;
  157.  CMDARROWSTABCMDx = FALSE;
  158.  CMDARROWSTABTXTx = FALSE;
  159.  CMDARROWSTABLRx = FALSE;
  160.  BACKUPx = TRUE;
  161.  BEEPx = FALSE;
  162.  CLOCKx = TRUE;
  163.  HEXDISPLAYx = TRUE;
  164.  IMPMACROx = TRUE;
  165.  IMPOSx = TRUE;
  166.  NUMBERx = TRUE;
  167.  CAPREXXOUTx = FALSE;
  168.  CAPREXXMAXx = 1000L;
  169.  
  170.  VER_STAx = 1;
  171.  VER_ENDx = max_line_length;
  172.  VER_COLx = 1;
  173.  ZON_STAx = 1;
  174.  ZON_ENDx = max_line_length;
  175.  DISPLAY_LOWx = DISPLAY_HIGHx = 0;
  176.  CLEARSCREENx = FALSE;
  177.  REPROFILEx = FALSE;
  178.  
  179.  AUSx = 0;
  180.  ARB_CHRx = '?';
  181.  ARB_STSx = OFF;
  182. #ifdef UNIX
  183.  EOLx = EOLOUT_LF;
  184. #endif
  185. #if defined(DOS) || defined(OS2)
  186.  EOLx = EOLOUT_CRLF;
  187. #endif
  188. #ifdef TRACE
  189.  trace_return();
  190. #endif
  191.  return;
  192. }
  193. /***********************************************************************/
  194. #ifdef PROTO
  195. void set_default_colours(void)
  196. #else
  197. void set_default_colours()
  198. #endif
  199. /***********************************************************************/
  200. {
  201. /*------------------------- external data -----------------------------*/
  202. extern bool colour_support;
  203. /*--------------------------- local data ------------------------------*/
  204.  chtype dflt_colour[ATTR_MAX];
  205.  register int i;
  206. /*--------------------------- processing ------------------------------*/
  207. #ifdef TRACE
  208.  trace_function("default.c: set_default_colours");
  209. #endif
  210. /*---------------------------------------------------------------------*/
  211. /* Set up default colours.                                             */
  212. /*---------------------------------------------------------------------*/
  213. #ifdef A_COLOR
  214.  if (colour_support)
  215.    {
  216.     init_pair(1,COLOR_WHITE,COLOR_BLUE);
  217.     init_pair(2,COLOR_WHITE,COLOR_BLUE);
  218.     init_pair(3,COLOR_BLUE,COLOR_WHITE);
  219.     init_pair(4,COLOR_RED,COLOR_WHITE);
  220.     init_pair(5,COLOR_BLACK,COLOR_CYAN);
  221.     init_pair(6,COLOR_BLUE,COLOR_WHITE);
  222.     init_pair(7,COLOR_RED,COLOR_WHITE);
  223.     init_pair(8,COLOR_BLACK,COLOR_CYAN);
  224.     init_pair(9,COLOR_BLACK,COLOR_CYAN);
  225.     init_pair(10,COLOR_RED,COLOR_WHITE);
  226.     init_pair(11,COLOR_RED,COLOR_WHITE);
  227.     init_pair(12,COLOR_WHITE,COLOR_BLUE);
  228.     init_pair(13,COLOR_WHITE,COLOR_BLUE);
  229.     init_pair(14,COLOR_RED,COLOR_WHITE);
  230.     init_pair(15,COLOR_RED,COLOR_WHITE);
  231.     init_pair(16,COLOR_BLUE,COLOR_WHITE);
  232.     init_pair(17,COLOR_RED,COLOR_WHITE);
  233.     for (i=0;i<ATTR_MAX;i++)
  234.         dflt_colour[i] = COLOR_PAIR(i+1);
  235.     dflt_colour[ATTR_CURLINE] |= A_BOLD;
  236.     dflt_colour[ATTR_TOFEOF] |= A_BOLD;
  237.     dflt_colour[ATTR_CTOFEOF] |= A_BOLD;
  238.     for (i=0;i<ATTR_MAX;i++)
  239.       if (colour[i])            /* a colour has been set up in profile */
  240.          set_colour(i,save_fg[i],save_bg[i],save_mod[i]);
  241.       else
  242.          colour[i] = dflt_colour[i];
  243.    }
  244.  else
  245.    {
  246.     dflt_colour[ATTR_FILEAREA] = A_NORMAL;           /* main window text lines */
  247.     dflt_colour[ATTR_CURLINE]  = A_BOLD;                       /* current line */
  248.     dflt_colour[ATTR_BLOCK]    = A_REVERSE;           /* text in markded block */
  249.     dflt_colour[ATTR_CBLOCK]   = A_BOLD | A_REVERSE;
  250.                                        /* current line if in marked block */
  251.     dflt_colour[ATTR_CMDLINE]  = A_BOLD;                       /* command line */
  252.     dflt_colour[ATTR_IDLINE]   = A_REVERSE;                    /* id line (top)*/
  253.     dflt_colour[ATTR_MSGLINE]  = A_BLINK;                      /* message line */
  254.     dflt_colour[ATTR_ARROW]    = A_BOLD;                       /* arrow prompt */
  255.     dflt_colour[ATTR_PREFIX]   = A_BOLD;                        /* prefix area */
  256.     dflt_colour[ATTR_PENDING]  = A_BOLD;            /* pending prefix commands */
  257.     dflt_colour[ATTR_SCALE]    = A_BOLD;                         /* scale line */
  258.     dflt_colour[ATTR_TOFEOF]   = A_BOLD;                      /* tof eof lines */
  259.     dflt_colour[ATTR_CTOFEOF]  = A_BOLD;     /* current line if on t/eof lines */
  260.     dflt_colour[ATTR_TABLINE]  = A_BOLD;                           /* tab line */
  261.     dflt_colour[ATTR_SHADOW]   = A_BOLD;                       /* shadow lines */
  262.     dflt_colour[ATTR_STATAREA] = A_REVERSE;             /* status line (bottom)*/
  263.